package im.engure.provider;

import im.engure.common.protocol.Protocol;
import im.engure.common.registery.LocalServiceRegistry;
import im.engure.common.registery.URL;
import im.engure.provider.serviceimpl.QuotesServiceImpl;
import org.apache.dubbo.common.extension.ExtensionLoader;

public class ProviderByDubboSpi {

    public static void main(String[] args) {

        //“注册服务”
        LocalServiceRegistry.registerService("im.engure.common.service.QuotesService",
                QuotesServiceImpl.class);

        //通过SPI机制获取使用的协议
        ExtensionLoader<Protocol> extensionLoader =
                ExtensionLoader.getExtensionLoader(Protocol.class);
        Protocol protocol = extensionLoader.getExtension("http");
        protocol.start(new URL("localhost", 8888));
    }
}
